package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.UserLoginDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Controller注解：将此类标识为控制器类,用于接收客户端发送的请求;
 */
@Controller
public class UserController {
    /**
     * 1.RequestMapping注解：根据请求的URL地址,映射到对应的控制器方法;
     * 2.ResponseBody注解：允许控制器方法以返回值的形式返回给客户端数据;
     */
    @RequestMapping("/v1/users/login")
    @ResponseBody
    public String login(){
        return "登录成功";
    }
    @RequestMapping("/v1/users/login2")
    @ResponseBody
    public String login2(UserLoginDTO userLoginDTO){
        String username = userLoginDTO.getUsername();
        String password = userLoginDTO.getPassword();
        return username +"注册成功";
    }

    @RequestMapping("/v1/users/login3")
    @ResponseBody
    public String login3(String username ,String password){
        return username+"+++"+password;
    }



}
